package main

import (
	"drama-go/internal/middleware"
	"drama-go/internal/models/query"
	_ "drama-go/internal/module/admin"
	"drama-go/internal/module/api"
	"github.com/worryry/8-pigeons/pkg/database/mysql"
	"github.com/worryry/8-pigeons/pkg/database/redis"
	"github.com/worryry/8-pigeons/pkg/logger"
	"github.com/worryry/8-pigeons/pkg/server/httpServer"
	"github.com/worryry/8-pigeons/pkg/server/router"
	"github.com/worryry/8-pigeons/pkg/setting"
)

func main() {
	//配置项
	setting.Start()
	//日志
	logger.Start()
	//加载数据库
	mysql.Start()
	query.SetDefault(mysql.DB)
	//加载redis
	redis.Start()

	//gen.Start()

	server := httpServer.NewHttp()
	r := server.GinNew()
	//加载路由文件
	r.Use(middleware.Cors())
	r.POST("/api/upload/file", api.Upload)
	r = router.InitRouter(r)

	server.Start(r)
}
